const config = require('../config')
const pageData = {
  appId: 519829,
  appType: 14,
  baseUrl: '',
  clientType: 'M',
  code: 200,
  hasCatePage: true,
  individual_m_switch: 'true',
  isAuction: false,
  isIndividual: true,
  isLuxuryGoodsVender: false,
  isMedicineShop: false,
  isSDKM: true,
  lingEntryOpen: true,
  lingTemplateMenu: true,
  message: '',
  messageMap: {},
  messages: [],
  mobilePageId: 9803555,
  mobileProjectId: 9542567,
  msg: '',
  msgLevel: 0,
  name: 'gxpt测试店铺-供应商',
  octopusSwitch: true,
  open: 1,
  pageInstanceId: 300198113,
  pingouShop: false,
  projectType: 6,
  promotionLabel4MiniApp: true,
  prototypeId: 1,
  resouceUrl: '',
  result: true,
  samShop: false,
  shopFuseTag: true,
  shopId: 170905,
  showTabUpdate: true,
  userPin: 'test_pop_gxpt_gong',
  venderId: 176343,
  venderType: 0,
  yaoB2B: false,
}
// 首页
const onHomePage = async (ctx) => {
  await ctx.render('index', {
    title: '松果编辑器',
    pageData: JSON.stringify(pageData),
    staticUrl: config.staticUrl,
    version: config.version,
  })
}

// iframe
const onIframe = async (ctx) => {
  await ctx.render('iframe', {
    title: '画布区域',
    staticUrl: config.staticUrl,
    version: config.version,
  })
}

module.exports = {
  onHomePage,
  onIframe,
}
